package masterSpringMvc.search.api;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.MatrixVariable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import masterSpringMvc.model.Tweet;
import masterSpringMvc.service.SearchService;

@RestController
@RequestMapping("/search/api")
@Secured("ROLE_ADMIN")
public class SearchApiController {
	@Autowired
	private SearchService searchService;
	
	@RequestMapping(value="/{searchType}",method=RequestMethod.GET)
	public List<Tweet> search(@PathVariable String searchType,@MatrixVariable List<String> keywords){
		return this.searchService.search(searchType, keywords);
	}
}
